package com.system.manager.modules.projectLibrary.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;

import com.system.manager.utils.DateUtils;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 
 * </p>
 *
 * @author jisf
 * @since 2021-11-03
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Project对象", description="")
public class Project implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "项目id")
    private String project_id;

    @ApiModelProperty(value = "项目名称")
    private String name;

    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "启动时间")
    private Date startTime;

    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "结束时间")
    private Date endTime;

    @ApiModelProperty(value = "简要介绍")
    private String introduce;

    @ApiModelProperty(value = "预期效果")
    private String expectEffect;

    @ApiModelProperty(value = "项目类型")
    private Integer projectType;

    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "申报时间")
    private Date applicationTime;

    @ApiModelProperty(value = "所属单位")
    private Integer firm;

    @ApiModelProperty(value = "所属部门")
    private Integer department;

    @ApiModelProperty(value = "项目负责人")
    private Integer principal;

    @ApiModelProperty(value = "二维码")
    private String qrCode;

    @ApiModelProperty(value = "条形码")
    private String barCode;

    @ApiModelProperty(value = "项目进展")
    private String evolve;

    @ApiModelProperty(value = "是否备案（null表示未提交，0表示未备案，1表示已备案，-1表示未通过）")
    private Integer putOnRecords;

    @ApiModelProperty(value = "是否验收（0表示未验收，1表示已验收）")
    private Integer checkAccept;

    @ApiModelProperty(value = "项目状态")
    private String state;

    @ApiModelProperty(value = "项目成果")
    private String achievement;

    public String getStartTimeString() {
        if(startTime != null){
            return DateUtils.format(startTime);
        }
        return "";
    }

    public String getEndTimeString() {
        if(endTime != null){
            return DateUtils.format(endTime);
        }
        return "";
    }

    public String getApplicationTimeString() {
        if(applicationTime != null){
            return DateUtils.format(applicationTime);
        }
        return "";
    }

    public Date getApplicationTime() {
        return applicationTime;
    }

    public String getIntroduce() {
        if(StringUtils.isEmpty(introduce)){
            return "暂无简介";
        }
        return introduce;
    }
}
